package com.quanyan.user.mq.Producer;

import com.quanyan.mq.mq.producer.AbstractMqProducer;
import com.quanyan.orderpay.service.OrderPayService;
import com.quanyan.user.constants.UserConstants;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author songzj
 * @date 16/6/14-15:05
 */
@Component("mqProducer")
public class MqProducer extends AbstractMqProducer {


    @Value("${mq.nameServer.address}")
    private String nameServerAddress;


    @Override
    protected String getProducerGroup() {
        return UserConstants.USER_TASK_GROUP;
    }

    @Override
    protected String getNameServerAddress() {
        return this.nameServerAddress;
    }

    @Override
    protected String getInstanceName() {  //用于发送消息给不同的集群.
        return UserConstants.USER_TASK_GROUP_INSTANCE;
    }

    @PostConstruct
    void run() {
        super.start();
    }
}
